package object05;

public class Demo05 {
    public static void main(String[] args) {
        Person p = new Person("三峰", 28);
        Animal a = new Animal();
        System.out.println(p.equals(a));

        Person p2 = new Person("四丰", 30);
        System.out.println(p.equals(p2));

        System.out.println(p2.equals(p2));//true 自己和自己比
        //同一个人的比较
        //同一个人(对象)的属性肯定都相同
    }
}
/**
 * java.lang.ClassCastException: object05.Animal cannot be cast to object05.Person
 * 强制转换异常
 *  Object obj=new Animal();
 *  Person p=(Person)obj; //其实相当于Person p=(Person)new Animal();
 *                        //由于Animal和Person是平级关系,所以不能强转
 * */